#ifdef UTIL_PLATFORM_WIN32
#include "fcntl.h"
#include "io/RandomAccessFile.h"
#include "io.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "lang/Exception.h"
using namespace yzrilyzr_lang;
namespace yzrilyzr_io{
	void RandomAccessFile::setLength(u_index newLength){
		checkOpen();
		fst.close();
		int fd=_open(filePath.c_str(), _O_RDWR);
		if(fd == -1){
			throw IOException("Failed to open file to set length");
		}
		if(_chsize_s(fd, newLength) != 0){
			_close(fd);
			throw IOException("Failed to set file size");
		}
		_close(fd);
		open(filePath, "rw");
	}
}
#endif